﻿using System;

namespace Problem9
{
	// Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000.
	class Problem0009
	{
		static void Main(string[] args)
		{
			int answer = 0;
			for (int a = 1; a < 500; a++) // a + b + c = 1000 so a and b can not be more than 500
			{
				for (int b = a; b < 500; b++)
				{
					int c = 1000 - a - b;
					if ((a * a) + (b * b) == (c * c))
					{
						answer = a * b * c;
						break;
					}
				}
				if (answer > 0)
					break;
			}

			Console.Write(answer);
			Console.ReadLine();
		}
	}
}
